GetAtPosition

Module: ecereCOM
Namespace: ecere::com
Class: Container

IteratorPointer GetAtPosition(const pos, bool create, bool * justAdded)

Description

Return an iterator to the element at position 'pos'. If create is true and the position is not currently occupied, an element will be added at that position. If an element was added as a result (with create set to true) and a non-null 'justAdded' pointer is passed, it will be set to true.

Parameters

pos  const   Index ('IT' parameter: integer for Array, Key for Map) 
create  bool  Set to true if the element should be created if it does not exist. 
justAdded  bool Used to request information whether a previously non-existent element was added (with create = true). The bool variable passed must be initialized to false by the caller. 
 
Return Value IteratorPointer  An iterator pointer to the element indexed, or null if not found and not created. 

Remarks


Avoid indexing linked lists by index as much as possible.

This method is used to implement the [ ] container indexing operator.